Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If any file changed only parse all files if force-update is true #1087

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

p8
Copy link
Contributor

@p8 p8 commented Jan 30, 2024

Commit 13e9a44 enforced parsing all files if any file is newer than the previous parse, not only updated files.

However, this did not take into account the --force-update option and would parse all files even if --force-update was false.

After this commit, if --force-update is false, only files newer than the previous parse will be parsed.
If --force-update is true (the default), all files will be parsed if any file newer than the previous parse.

Commit 13e9a44 enforced parsing all
files if any file is newer than the previous parse, not only updated
files.

However, this did not take into account the `--force-update` option and
would parse all files even if `--force-update` was false.

After this commit, if `--force-update` is false, only files newer than
the previous parse will be parsed.
@p8 p8 force-pushed the fix/gather-files-with-force-no-update branch from d0136b7 to b9cd477 Compare January 30, 2024 21:02
@nobu
Copy link
Member

nobu commented Jan 31, 2024

This breaks references to labels in unchanged files from a newer file.

@p8
Copy link
Contributor Author

p8 commented Jan 31, 2024

Maybe I'm missing some context here, but I think currently RDoc works as follows:

  1. Parse all files and generate RDoc files for all files if any file is newer than the last parse.
  2. Don't parse/generate any files if --no-force-update option is passed and no file is newer than the last parse.

This seems to make the --no-force-update option obsolete because it will only not generate any files if no files changed.

There doesn't seem to be an option to only update a single RDoc generated file. It either generates all files or no files.
So testing a small change in the documentation in a single file will always generate all RDoc files.
For large projects with a lot of files, this could take some time.

With this change, to not break references to labels the --no-force-update option should be skipped.
As --force-update is true by default, it will generate all files when a single file is updated.

Commit 13e9a44 also specifically mentions --force-update:

This commit makes --force-update option enforce to parse
all files if any file is newer than the previous parse, not only
updated files.

But that commit enforces parsing all files with the --no-force-update option as well.

@nobu
Copy link
Member

nobu commented Feb 18, 2024

RDoc can detect labels only in parsed files, and to tell if words look like labels are really labels, it needs to parse those files actually.

Consider a project that has two files, foo.rb and bar.rb.

# foo.rb

# Uses Bar
class Foo 
end
# bar.rb

# Used by Foo
class Bar
end

rdoc . parses both files, and report as Files: 2 and Classes: 2.

Now you touch one, foo.rb, and run rdoc --no-force-update, with your patched version.
Then reported as Files: 1 and Classes: 1, as you expected.
But now the updated file doc/Foo.html does not contain a link to Bar.html.
Again touch the other bar.rb and re-generate, in this time doc/Bar.html looses the link too.

@st0012 st0012 self-requested a review October 17, 2024 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants